package com.github.yoojia.mqtt.boot;

import com.annimon.stream.function.Predicate;

/**
 * @author Yoojia Chen (yoojiachen@gmail.com)
 * @since 1.0
 */
class Predicates {

    public static Predicate<ActuatorConf> ofPatternType(final PatternType type){
        return new Predicate<ActuatorConf>(){
            @Override
            public boolean test(ActuatorConf value) {
                return type.equals(value.patternType);
            }
        };
    }

    public static Predicate<ActuatorConf> ofActuatorEnabled(){
        return new Predicate<ActuatorConf>() {
            @Override
            public boolean test(ActuatorConf value) {
                return ! value.disabled;
            }
        };
    }

    public static Predicate<PluginConf> ofPluginEnabled(){
        return new Predicate<PluginConf>() {
            @Override
            public boolean test(PluginConf value) {
                return ! value.disabled;
            }
        };
    }
}
